package edu.vt.ece.rt.benchmark.intruder;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;

public class StreamGenerate {

	public static void main(String args[]) {
		
		Dictionary dictionaryPtr = new Dictionary();
		Stream streamPtr = new Stream("stream",Intruder.PARAM_DEFAULT_ATTACK);
		Stream.stream_generate(streamPtr, dictionaryPtr, Intruder.PARAM_DEFAULT_NUM, 
				Intruder.PARAM_DEFAULT_SEED, Intruder.PARAM_DEFAULT_LENGTH);

		try{
			OutputStream file = new FileOutputStream("stream");
			OutputStream buffer = new BufferedOutputStream(file);
			ObjectOutput obj = new ObjectOutputStream(buffer);			
			obj.writeObject(streamPtr);
			obj.close();
		
			InputStream file1 = new FileInputStream("stream");
			InputStream buffer1 = new BufferedInputStream(file1);
			ObjectInput input1 = new ObjectInputStream(buffer1);
			Stream streamPtr1 = (Stream)input1.readObject();
			
			System.out.println("ID is "+streamPtr1.id);
			System.out.println("attack percent is "+streamPtr1.percentAttack);
			System.out.println("size is "+streamPtr1.packetQueuePtr.size());
			
		} catch (Exception e) {
			
		}
		
		
		
		
		
	}


	
}
